<extend name="./Template/Layout/Layout.html" />
<block name="style"></block>
<block name="body">
  <div id="content-main" style="width:100%;">
    <form class="layui-form" action="" style="padding: 20px;">

      <input type="hidden" class="ArticleWriteId" value="{$info.id}">

      <div class="layui-form-item">
        <label class="layui-form-label w120">文章标题</label>
        <div class="layui-input-block ml120">
          <input type="text" class="layui-input ArticleWriteTitle" name="title" lay-verify="title" autocomplete="off" placeholder="请填写文章标题" value="{$info.title}"></div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label w120">
          <span class="text-danger">*</span>栏目分类</label>
        <div class="layui-input-block ml120">
            <select name="interest" class="ArticleWriteColumn" lay-filter="aihao">
                <foreach name="menu" item="vo">
                    <option value="{$vo.id}" <if condition="$info['column'] eq $vo['id']">selected="selected"</if>>{$vo.title}</option>
                </foreach>
            </select>
        </div>
      </div>

      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label w120">描述</label>
        <div class="layui-input-block ml120">
            <textarea placeholder="请输入内容" class="ArticleWriteDescription layui-textarea">{$info.description}</textarea>
        </div>
      </div>

      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label w120">内容</label>
        <div class="layui-input-block ml120 ArticleWriteTextarea">
          <textarea class="ml120" class="ArticleWriteContent" id="textEdit" placeholder="请输入内容">{$info.content}</textarea>
        </div>
      </div>

      <div class="layui-form-item">
        <div class="layui-input-block ml120">
          <a href="javascript:void(0);" class="ArticleWriteSubmit layui-btn layui-btn-normal" ><if condition="$info">保存<else />添加</if></a>
          <a href="{:U('Home/Article/ArticleList')}" class="ArticleWriteBack layui-btn layui-btn-primary">返回</a>
        </div>
      </div>

    </form>
  </div>
</block>
<block name="script">
  <script>
      var saveurl = "{:U('Home/Article/ArticleWrite')}";
      //强行改变textarea字体颜色
      window.onload = function (){
          var fp = setInterval(function(){
              var is_exites = document.getElementsByClassName('ArticleWriteTextarea')[0].getElementsByTagName('iframe')[0];
              if(is_exites){
                  is_exites.contentWindow.document.body.style.color = "#fff";
                  var text = is_exites.contentWindow.document.body.innerHTML;
                  clearInterval(fp);
              }
          },100)
      }
  </script>
</block>